Skip to content

Fix Player and RoomCountBox tooltip not updating#242

Closed
Packsolite wants to merge 1 commit intoTeamWheelWizard:devfrom
Packsolite:fix/issue-241
Closed

Fix Player and RoomCountBox tooltip not updating#242
Packsolite wants to merge 1 commit intoTeamWheelWizard:devfrom
Packsolite:fix/issue-241

Conversation

@Packsolite
Copy link

@Packsolite Packsolite commented Mar 15, 2026

Purpose of this PR:

This PR fixes my previously reported issue #241 for the tooltips for the player and room count boxes not updating correctly.

How to Test:

  1. Start the application.
  2. Wait for the player/room counts to update.
  3. Hover over the player count and room count boxes.
  4. Confirm the tooltip shows the correct current values.

What Has Been Changed:

  • Replaced TipText with ToolTip.Tip in Layout.axaml.
  • Updated the tooltip dynamically using ToolTip.SetTip in Layout.axaml.cs.

Related Issue Link:

#241

Checklist before merging

  • You have created relevant tests

No because i have not found any matching examples.

Summary by CodeRabbit

  • Refactor

    • Updated tooltip implementation for UI components while maintaining existing tooltip functionality.
  • Chores

    • Removed unused code references for improved code clarity.

@coderabbitai
Copy link

coderabbitai bot commented Mar 15, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b216aac3-2fd0-44d8-8a2f-d12198d16eab

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes migrate tooltip implementation from custom TipText properties to the standard Avalonia ToolTip.Tip mechanism across the Layout view and its code-behind, while removing unused using directives.

Changes

Cohort / File(s) Summary
XAML Tooltip Binding Updates
WheelWizard/Views/Layout.axaml
Replaced StateBox.TipText bindings with ToolTip.Tip on two StateBox controls to adopt standard Avalonia tooltip pattern.
Code-Behind Refactoring
WheelWizard/Views/Layout.axaml.cs
Removed unused using directives (WheelWizard.Views.Components, WheelWizard.WiiManagement) and replaced TipText property assignments with ToolTip.SetTip() calls for PlayerCountBox and RoomCountBox.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A hop, skip, and binding refactor,
Custom tips now standard, much better!
Tooltips aligned with Avalonia's grace,
Cleaner code in its rightful place!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing tooltip updates for player and room count boxes.
Description check ✅ Passed The description includes all required template sections with clear details about purpose, testing steps, changes made, and related issue link.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can generate a title for your PR based on the changes.

Add @coderabbitai placeholder anywhere in the title of your PR and CodeRabbit will replace it with a title based on the changes in the PR. You can change the placeholder by changing the reviews.auto_title_placeholder setting.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@WheelWizard/Views/Layout.axaml`:
- Around line 69-76: The StateBox instances (PlayerCountBox and RoomCountBox)
are setting the attached ToolTip.Tip instead of the control's TipText property
which the template binds to via TemplateBinding; change the properties on these
StateBox controls to set TipText (e.g., TipText="{x:Static
lang:Phrases.Hover_PlayersOnline_0}" and TipText="{x:Static
lang:Phrases.Hover_RoomsOnline_0}") so the template's Border tooltip receives
the value.

In `@WheelWizard/Views/Layout.axaml.cs`:
- Around line 199-218: The code currently uses ToolTip.SetTip(...) on
PlayerCountBox and RoomCountBox which sets the attached ToolTip property on the
control but is ignored by the StateBox template that reads TipText via
TemplateBinding; replace the ToolTip.SetTip calls by assigning the computed
strings to the TipText property on the StateBox instances (e.g.
PlayerCountBox.TipText = ... and RoomCountBox.TipText = ... using the same
playerCount/roomCount switch logic) and remove the ToolTip.Tip bindings from the
StateBox elements in the layout so the template-bound Border reads the new
TipText values.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f367e0d7-4f37-4d12-bdb6-73c1fcfc79c5

📥 Commits

Reviewing files that changed from the base of the PR and between c967554 and 681fd28.

📒 Files selected for processing (2)
  • WheelWizard/Views/Layout.axaml
  • WheelWizard/Views/Layout.axaml.cs

Comment on lines 69 to 76
<components:StateBox x:Name="PlayerCountBox" Text="0" Variant="Dark"
IconData="{StaticResource UserCouple}"
TipText="{x:Static lang:Phrases.Hover_PlayersOnline_0}"
ToolTip.Tip="{x:Static lang:Phrases.Hover_PlayersOnline_0}"
Margin="10,0,0,0" />
<components:StateBox x:Name="RoomCountBox" Text="0" Variant="Dark"
IconData="{StaticResource RoomUsers}"
TipText="{x:Static lang:Phrases.Hover_RoomsOnline_0}"
ToolTip.Tip="{x:Static lang:Phrases.Hover_RoomsOnline_0}"
Margin="10,0,0,0" />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify how StateBox template handles tooltips
echo "=== StateBox.axaml tooltip binding ==="
rg -n "ToolTip.Tip" --type=xml -C3 -g "*StateBox*"

echo ""
echo "=== TipText property definition ==="
ast-grep --pattern $'public static readonly StyledProperty<string> TipTextProperty = $_'

Repository: TeamWheelWizard/WheelWizard

Length of output: 853


🏁 Script executed:

fd -type f "StateBox.axaml.cs"

Repository: TeamWheelWizard/WheelWizard

Length of output: 241


🏁 Script executed:

# Search for TipText property in StateBox files
rg -n "TipText" -C5 -g "*StateBox*"

Repository: TeamWheelWizard/WheelWizard

Length of output: 5855


Set TipText property instead of ToolTip.Tip attached property on StateBox controls.

The StateBox template (in StateBox.axaml:30) binds its internal Border's tooltip via ToolTip.Tip="{TemplateBinding TipText}". Setting ToolTip.Tip directly on the StateBox control here will not work because the TemplateBinding explicitly binds to the TipText property, which remains unset.

Use the TipText property instead (as seen in other StateBox usages in the codebase):

Example fix
-            <components:StateBox x:Name="PlayerCountBox" Text="0" Variant="Dark"
+            <components:StateBox x:Name="PlayerCountBox" Text="0" Variant="Dark" TipText="..."
                                  IconData="{StaticResource UserCouple}"
-                                 ToolTip.Tip="{x:Static lang:Phrases.Hover_PlayersOnline_0}"
                                  Margin="10,0,0,0" />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@WheelWizard/Views/Layout.axaml` around lines 69 - 76, The StateBox instances
(PlayerCountBox and RoomCountBox) are setting the attached ToolTip.Tip instead
of the control's TipText property which the template binds to via
TemplateBinding; change the properties on these StateBox controls to set TipText
(e.g., TipText="{x:Static lang:Phrases.Hover_PlayersOnline_0}" and
TipText="{x:Static lang:Phrases.Hover_RoomsOnline_0}") so the template's Border
tooltip receives the value.

Comment on lines +199 to +218
ToolTip.SetTip(
PlayerCountBox,
playerCount switch
{
1 => Phrases.Hover_PlayersOnline_1,
0 => Phrases.Hover_PlayersOnline_0,
_ => Humanizer.ReplaceDynamic(Phrases.Hover_PlayersOnline_x, playerCount)
?? $"There are currently {playerCount} players online",
}
);
RoomCountBox.Text = roomCount.ToString();
RoomCountBox.TipText = roomCount switch
{
1 => Phrases.Hover_RoomsOnline_1,
0 => Phrases.Hover_RoomsOnline_0,
_ => Humanizer.ReplaceDynamic(Phrases.Hover_RoomsOnline_x, roomCount) ?? $"There are currently {roomCount} rooms active",
};
ToolTip.SetTip(
RoomCountBox,
roomCount switch
{
1 => Phrases.Hover_RoomsOnline_1,
0 => Phrases.Hover_RoomsOnline_0,
_ => Humanizer.ReplaceDynamic(Phrases.Hover_RoomsOnline_x, roomCount) ?? $"There are currently {roomCount} rooms active",
}
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Avalonia ToolTip attached property inheritance vs TemplateBinding precedence

💡 Result:

In Avalonia, these are two separate mechanisms:

1) Inheritance (“inherits: true”) is low precedence

Property inheritance only applies to properties registered with inherits: true, and inherited values use BindingPriority.Inherited, which is lower priority than styles and templates. (docs.avaloniaui.net)

So even if an attached property is inheritable, an inherited value will lose to any template-provided value.

2) TemplateBinding is BindingPriority.Template (higher than styles + inheritance)

Values coming from a ControlTemplate (including TemplateBinding) use BindingPriority.Template, which is higher priority than Style and Inherited. (docs.avaloniaui.net)

Implication: if a template part sets ToolTip.Tip="{TemplateBinding ToolTip.Tip}", then:

  • A style setter on that template part generally won’t override it (style is lower priority than template). (docs.avaloniaui.net)
  • A local value on that template part will override it (local is higher than template). (docs.avaloniaui.net)

3) ToolTip.Tip specifically: don’t assume it inherits

ToolTip.Tip is an attached property defined by ToolTip. (docs.avaloniaui.net)
But not all tooltip attached properties are inheritable (e.g., ShowOnDisabled is explicitly registered as inheritable in Avalonia). (stackoverflow.com)
So if you’re expecting ToolTip.Tip to “flow down” the tree via inheritance, it may not—whereas TemplateBinding will still copy the templated parent’s value into the template part.

Practical rule of thumb

  • If you want the tooltip content to be customizable from the control instance, bind it in the template (TemplateBinding).
  • If you want to override the tooltip on a specific element inside the template, set ToolTip.Tip locally on that element (or modify the template), because plain style setters typically won’t beat a template-set value. (docs.avaloniaui.net)

Citations:


🏁 Script executed:

find . -type f -name "StateBox.axaml*" | head -5

Repository: TeamWheelWizard/WheelWizard

Length of output: 165


🏁 Script executed:

find . -type f -name "Layout.axaml*" | head -5

Repository: TeamWheelWizard/WheelWizard

Length of output: 139


🏁 Script executed:

cat -n ./WheelWizard/Views/Components/StateBox.axaml

Repository: TeamWheelWizard/WheelWizard

Length of output: 9504


🏁 Script executed:

cat -n ./WheelWizard/Views/Components/StateBox.axaml.cs

Repository: TeamWheelWizard/WheelWizard

Length of output: 3895


🏁 Script executed:

sed -n '199,218p' ./WheelWizard/Views/Layout.axaml.cs

Repository: TeamWheelWizard/WheelWizard

Length of output: 868


🏁 Script executed:

sed -n '71,75p' ./WheelWizard/Views/Layout.axaml

Repository: TeamWheelWizard/WheelWizard

Length of output: 458


🏁 Script executed:

sed -n '65,80p' ./WheelWizard/Views/Layout.axaml

Repository: TeamWheelWizard/WheelWizard

Length of output: 1009


Use the TipText property instead of ToolTip.SetTip(); direct attached property setting bypasses the template binding.

The StateBox template binds its internal Border's ToolTip.Tip to the TipText property via TemplateBinding (StateBox.axaml:30). Calling ToolTip.SetTip() on the StateBox instance sets the attached property on the control itself, but the Border (which renders the tooltip) only reads from TipText. Setting StateBox.ToolTip.Tip has no effect on what displays.

Assign to TipText directly instead:

🔧 Proposed fix
         PlayerCountBox.Text = playerCount.ToString();
-        ToolTip.SetTip(
-            PlayerCountBox,
-            playerCount switch
-            {
-                1 => Phrases.Hover_PlayersOnline_1,
-                0 => Phrases.Hover_PlayersOnline_0,
-                _ => Humanizer.ReplaceDynamic(Phrases.Hover_PlayersOnline_x, playerCount)
-                    ?? $"There are currently {playerCount} players online",
-            }
-        );
+        PlayerCountBox.TipText = playerCount switch
+        {
+            1 => Phrases.Hover_PlayersOnline_1,
+            0 => Phrases.Hover_PlayersOnline_0,
+            _ => Humanizer.ReplaceDynamic(Phrases.Hover_PlayersOnline_x, playerCount)
+                ?? $"There are currently {playerCount} players online",
+        };
         RoomCountBox.Text = roomCount.ToString();
-        ToolTip.SetTip(
-            RoomCountBox,
-            roomCount switch
-            {
-                1 => Phrases.Hover_RoomsOnline_1,
-                0 => Phrases.Hover_RoomsOnline_0,
-                _ => Humanizer.ReplaceDynamic(Phrases.Hover_RoomsOnline_x, roomCount) ?? $"There are currently {roomCount} rooms active",
-            }
-        );
+        RoomCountBox.TipText = roomCount switch
+        {
+            1 => Phrases.Hover_RoomsOnline_1,
+            0 => Phrases.Hover_RoomsOnline_0,
+            _ => Humanizer.ReplaceDynamic(Phrases.Hover_RoomsOnline_x, roomCount) 
+                ?? $"There are currently {roomCount} rooms active",
+        };

Also remove the ToolTip.Tip bindings in Layout.axaml (lines 71, 75) on both StateBox elements and rely solely on TipText assignments.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@WheelWizard/Views/Layout.axaml.cs` around lines 199 - 218, The code currently
uses ToolTip.SetTip(...) on PlayerCountBox and RoomCountBox which sets the
attached ToolTip property on the control but is ignored by the StateBox template
that reads TipText via TemplateBinding; replace the ToolTip.SetTip calls by
assigning the computed strings to the TipText property on the StateBox instances
(e.g. PlayerCountBox.TipText = ... and RoomCountBox.TipText = ... using the same
playerCount/roomCount switch logic) and remove the ToolTip.Tip bindings from the
StateBox elements in the layout so the template-bound Border reads the new
TipText values.

@patchzyy
Copy link
Member

Hey, before you spend any more time on this
first thank you for contributing to wheel wizard! i really appriciate it
could you please change your target branch from main to DEV since that is where all of the next updates are developed
and currently in dev a half fix is already present i would take a look at that if you want to <3

@Packsolite Packsolite marked this pull request as draft March 15, 2026 18:41
@Packsolite Packsolite changed the base branch from main to dev March 15, 2026 18:44
@Packsolite
Copy link
Author

Packsolite commented Mar 15, 2026

currently in dev a half fix is already present i would take a look at that if you want to <3

Looks like the bug is already fixed in dev. Sorry for wasting your time.
image

@Packsolite Packsolite closed this Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants